#include <iostream>
#include <memory> //跟智能指针有关的头文件
using namespace std;


/*
	三种智能指针对象之间赋值
*/
int main()
{
	shared_ptr<int> p1(new int);
	//存放数据到p1里面
	*p1=123;
	
	//再来新建一个智能指针对象
	shared_ptr<int> p2;  //野指针
	p2=p1;  
	cout<<"*p1 is: "<<*p1<<endl;
	cout<<"*p2 is: "<<*p2<<endl;
	
	shared_ptr<int> p3;  //野指针
	p3=p1;  
	cout<<"*p1 is: "<<*p1<<endl;
	cout<<"*p2 is: "<<*p2<<endl;
	cout<<"*p3 is: "<<*p3<<endl;
}